#ifndef __LOS_TIMER_H__
#define __LOS_TIMER_H__

#ifdef __cplusplus
extern "C" {
#endif

typedef struct los_mutex_lcb tag_mutex_cb;
typedef struct los_sem_lcb tag_semp_cb;

enum los_timer_state_e
{
    LOS_TIMER_ERROR,
    LOS_TIMER_INIT,
    LOS_TIMER_STOP,
    LOS_TIMER_RUNNIG,
    LOS_TIMER_ISR,
};

struct los_timer_t
{
    // inherent from djyq_node_t
    struct losq_node_t node;
    void (*cb)(void *param);
    void *param;
    uint32_t interval;
    int trigger_cnt;
    enum los_timer_state_e state;
};

void los_timer_init(void);
void los_timer_free(struct los_timer_t *timer);
struct los_timer_t *los_timer_create(uint32_t interval, int16_t trigger_cnt,
                                        void (*cb)(void *), void *param);
void los_timer_start(struct los_timer_t *timer);
void los_timer_stop(struct los_timer_t *timer);
enum los_timer_state_e los_timer_get_status(struct los_timer_t *timer);

#ifdef __cplusplus
}
#endif

#endif
